package com.expert.conrtoller;

import com.expert.pojo.Project;
import com.expert.result.Result;
import com.expert.service.TodoService;
import io.swagger.models.auth.In;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * @ClassName: TodoController
 * @Author: cxs
 * @Date: 2024/03/29 22:56
 * @Description:
 **/
@RestController
@RequestMapping("/todo")
@Slf4j
public class TodoController {

    @Autowired
    TodoService todoService;


    /**
     * 获取评标邀请信息
     * @return
     */
    @GetMapping("/getInvite")
    public Result<List<Project>> getInviteData(){
        log.info("获取评标邀请信息");
        List<Project> inviteData=this.todoService.getInviteData();
        return Result.success(inviteData);
    }

    /**
     * 接受邀请或拒绝邀请
     * @return
     */
    @PostMapping("/accept")
    public Result accept(Long id, Integer accept){
        log.info("获取评标邀请信息");
       this.todoService.accept(id,accept);
        return Result.success();
    }

    /**
     * 获取待签到列表
     * @return
     */
    @GetMapping("/getAttendance")
    public Result<List<Project>> getAttendance(){
        log.info("获取签到信息");
       List<Project> attendanceData=this.todoService.getAttendance();
       return  Result.success(attendanceData);
    }

    /**
     * 签到
     * @param projectId
     * @param value
     * @return
     */
    @PostMapping("/attendance")
    public Result attendance(Long projectId, String value){
        log.info("获取评标邀请信息");
        this.todoService.attendance(projectId,value);
        return Result.success();
    }

    /**
     * 查询待评分项目
     * @return
     */
    @GetMapping("/getToScore")
    public Result<List<Project>> getToScore(){
        log.info("查询待评分项目");
       List<Project> toScore= this.todoService.getToScore();
       return Result.success(toScore);
    }
}
